//
//  AppDelegate.swift
//  jingsha
//
//  Created by 卢逢卫 on 2025/2/28.
//

import UIKit
import IQKeyboardManagerSwift

@main
class AppDelegate: UIResponder, UIApplicationDelegate {
    
    var window: UIWindow?
    let tabBarCon = MainController()
    /// 自动登录
    let AutimoticLogin = UserDefaultsManager.queryDataForBool(UserDefaultsName.User_autimoticLogin)
    let loginCon  = CN_BaseNavController.init(rootViewController : Login_Con())
    
    func iqkeyboradSetting(){
        
        // IQKeyboardManager
        IQKeyboardManager.shared.enable = true
        IQKeyboardManager.shared.shouldResignOnTouchOutside = true
        IQKeyboardManager.shared.enableAutoToolbar = true
        IQKeyboardManager.shared.layoutIfNeededOnUpdate = true
        IQKeyboardManager.shared.keyboardDistanceFromTextField = 30
    }
    
    func showRootView() {
        
        self.window = UIWindow(frame: UIScreen.main.bounds)
        self.window?.backgroundColor = UIColor.white
//        if AutimoticLogin == true {
           
            self.window?.rootViewController = tabBarCon
            
//        } else {
//            self.window?.rootViewController = loginCon
//        }
        self.window?.makeKeyAndVisible()
    }

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        iqkeyboradSetting()
        showRootView()
        return true
    }

  

}

